home *** CD-ROM | disk | FTP | other *** search
- ##SUPPORT
-
- void DrawFuel( struct Window *Wnd, struct FuelGauge *Gauge )
- {
- DrawBevelBox( Wnd->RPort,
- Gauge->Left + XOffset,
- Gauge->Top + YOffset,
- Gauge->Width,
- Gauge->Height,
- GT_VisualInfo, VisualInfo,
- GTBB_Recessed, TRUE,
- TAG_DONE );
- }
-
- void SetFuel( struct Window *Wnd, struct FuelGauge *Gauge )
- {
- UWORD x, y, x2, y2;
-
- x = Gauge->Left + XOffset;
- y = Gauge->Top + YOffset;
-
- if ( Gauge->Tot != 0 ) {
-
- if( Gauge->Freedom ) {
- x2 = x + Gauge->Width - 3;
- y2 = y + (( Gauge->Height - 1 ) * Gauge->Part ) / Gauge->Tot;
- } else {
- x2 = x + (( Gauge->Width - 2 ) * Gauge->Part ) / Gauge->Tot;
- y2 = y + Gauge->Height - 2;
- }
-
- SetAPen( Wnd->RPort, 3 );
- RectFill( Wnd->RPort, x + 2, y + 1, x2, y2 );
-
- } else {
-
- SetAPen( Wnd->RPort, 0 );
- RectFill( Wnd->RPort,
- x + 2, y + 1,
- x + Gauge->Width - 3,
- y + Gauge->Height - 2 );
- }
- }
-
- ##SUPPORT-FA
-
- void DrawFuel( struct Window *Wnd, struct FuelGauge *Gauge )
- {
- DrawBevelBox( Wnd->RPort,
- ScaleX( Gauge->Left ) + XOffset,
- ScaleY( Gauge->Top ) + YOffset,
- ScaleX( Gauge->Width ),
- ScaleY( Gauge->Height ),
- GT_VisualInfo, VisualInfo,
- GTBB_Recessed, TRUE,
- TAG_DONE );
- }
-
- void SetFuel( struct Window *Wnd, struct FuelGauge *Gauge )
- {
- UWORD x, y, x2, y2;
-
- x = ScaleX( Gauge->Left ) + XOffset;
- y = ScaleY( Gauge->Top ) + YOffset;
-
- if ( Gauge->Tot != 0 ) {
-
- if( Gauge->Freedom ) {
- x2 = x + ScaleX( Gauge->Width ) - 3;
- y2 = y + ((( ScaleY( Gauge->Height ) - 1 ) * Gauge->Part ) / Gauge->Tot );
- } else {
- x2 = x + ((( ScaleX( Gauge->Width ) - 2 ) * Gauge->Part ) / Gauge->Tot );
- y2 = y + ScaleY( Gauge->Height ) - 2;
- }
-
- SetAPen( Wnd->RPort, 3 );
- RectFill( Wnd->RPort, x + 2, y + 1, x2, y2 );
-
- } else {
-
- SetAPen( Wnd->RPort, 0 );
- RectFill( Wnd->RPort,
- x + 2, y + 1,
- x + ScaleX( Gauge->Width ) - 3,
- y + ScaleY( Gauge->Height ) - 2 );
- }
- }
-
- ##DATA
-
- struct FuelGauge %oGauge = {
- %x, %y,
- %W, %h,
- 0, 0,
- %f
- };
-
- ##RENDER
-
- DrawFuel( %wWnd, &%oGauge );
- SetFuel( %wWnd, &%oGauge );
-
- ##HEADER
-
- struct FuelGauge {
- WORD Left, Top;
- UWORD Width, Height;
- ULONG Tot, Part;
- UBYTE Freedom;
- };
-
- extern void SetFuel( struct Window *, struct FuelGauge * );
-
- ##EXTERN
- extern struct FuelGauge %oGauge;
-
- ##end
-